<template>
<div class="info flex align-items space-between">
    <div class="left flex1">
        <div class="top  flex align-items flex-start">
            <div class="name">{{ info.name }}</div>
            <div class="phone">{{ info.mobile }}</div>
            <div class="default fn-ctr" v-if='info.is_def == 1'>默认</div>
        </div>
        <div class="address ell2">{{ info.address }}
            <Tag  plain type="primary" @click='copyAddress(info.address)'>复制</Tag>
        </div>
    </div>
    <div class="right" @click='addressEdit' v-if='mode == 1'>
        <img :src="editPic" alt="">
    </div>
</div>
</template>

<script>
import { Tag } from 'vant';
import editPic from '@/assets/edit.png';
export default {
    components:{Tag},
    props: {
        info:Object,
        mode:{
            type:[Number,String],
            default:1,
        }
    },
    data() {
        return {
            editPic,
        }
    },
    methods:{
        addressEdit(){
            this.$router.push({name:"myaddressadd",query:{mode:2,id:this.info.id}})
        },
        copyAddress(address){
            this.$copyText(address);
        }
    }
}
</script>

<style lang="less" scoped>
.info {
    width: 100%;
    height: auto;
    padding: 20px 0;
    background-color: #fff;
    border-bottom: 1px solid #F2F4F6;

    .right {
        width: 13px;
        height: 13px;
    }

    .left {
        padding-right: 20px;
    }

    .top {
        width: 100%;
        margin-bottom: 10px;

        .name {
            font-size: 16px;
            font-family: PingFang SC;
            font-weight: bold;
            color: #333333;
            margin-right: 24px;
        }

        .phone {
            font-size: 14px;
            font-family: PingFang SC;
            font-weight: 400;
            color: #999999;
            margin-right: 17px;
        }

        .default {
            width: 34px;
            height: 17px;
            border: 1px solid #FF5522;
            border-radius: 5px;
            font-size: 11px;
            font-family: PingFang SC;
            font-weight: 400;
            color: #FF5522;
        }
    }

    .address {
        width: 100%;
        font-size: 14px;
        font-family: PingFang SC;
        font-weight: 400;
        color: #333333;
    }
}
</style>
